<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>消息详情</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
	<script src="__PUBLIC__/News/js/jweixin-1.1.0.js"></script>
	<link rel="stylesheet" href="__PUBLIC__/News/css/weui.min.css"/>
    <link rel="stylesheet" href="__PUBLIC__/News/css/example.css"/>
	<script src="__PUBLIC__/News/js/jquery.js"></script>
	<style>
	</style>
	<script>
		wx.config({
			//关闭调试模式
		    debug: false,
		    appId: '<?php echo $signPackage["appId"];?>',
		    timestamp: <?php echo $signPackage["timestamp"];?>,
		    nonceStr: '<?php echo $signPackage["nonceStr"];?>',
		    signature: '<?php echo $signPackage["signature"];?>',
		    jsApiList: [
		      // 所有要调用的 API 都要加到这个列表中
		      'closeWindow','hideOptionMenu'
		    ]
	    });
	    wx.ready(function(){
 			//屏蔽菜单
 			wx.hideOptionMenu();
		});
		function close_window(){
			wx.closeWindow();
		}
	</script>
	<script>
		//初始化全局时间计时变量
		var read_time = 0;
		$(function(){
			//消息计时器开始
			window.setInterval("plus_time()",1000);
			//初始化变量区域
			var news_id = '<?php echo $news_id?>';
			var userid = '<?php echo $userid?>';
			//已阅事件处理
			$('#has_read').bind('click',function(){
				var data = {
					news_id:news_id,
					user_id:userid,
					read_time:read_time,
				};
				//ajax提交已阅数据
				$.post('__CONTROLLER__/receipt/state/{$corpid}',data,function(res){
					if(res==1||res==0){
						//关闭当前消息
						close_window();
					}
				},'json');
			});
			
			//关闭事件监听
			$('#msg_close').bind('click',function(){
				close_window();
			});
		});
		
		//计时方法
		function plus_time(){
			read_time++;
		}
	</script>
</head>
<body>	
	 <div class="weui-panel" style="margin-top:3%;height: 75%;overflow: auto;">
        <div class="weui-panel__hd" style="font-size: 4vw;">
        	消息来自:<span style="font-weight:bold;"><?php echo $send_from;?></span>
        	时间:<?php echo $time;?>
        </div>
        <div class="weui-panel__bd" id="msg_bg">
            <div class="weui-media-box weui-media-box_text" style="overflow: auto;">
                <h4 class="weui-media__title" style="font-size: 6vw;"><?php echo $content['title'];?></h4>
                <p style="color:black;font-size: 5vw;text-indent: 2em;">
                	<?php echo $content['content'];?>
                </p>
            </div>
        </div>
    </div>
    <br/>
    <?php
    	if($is_read):
    ?>
     <div class="page__bd page__bd_spacing">
     	<a class="weui-btn weui-btn_primary" id="msg_close" href="javascript:;">关闭</a>
     </div>
    <?php
    	else:	
    ?>
     <div class="page__bd page__bd_spacing">
     	<a class="weui-btn weui-btn_primary" id="has_read" href="javascript:;">已阅回执</a>
     </div>
    <?php
    	endif;	
    ?>
    <div class="weui-msg__extra-area">
            <div class="weui-footer">
                <p class="weui-footer__links">
                    <a href="javascript:void(0);" class="weui-footer__link">中国航天 | 神舟软件</a>
                </p>
                <p class="weui-footer__text">Copyright &copy; 2003-2017</p>
            </div>
    </div>
</body>
</html>